<template>
   <footer class="footer">
      <ul>
        <!-- router-link(声明式跳转) 结合to属性进行页面的跳转 默认会生成a标签 使用tag属性生成目标标签 -->
        <router-link to='/home' tag='li'>
          <span class="iconfont icon-shouye"></span>
          <p>首页</p>
        </router-link>
        <router-link to='/classify' tag='li'>
          <span class="iconfont icon-fenleifuben"></span>
          <p>分类</p>
        </router-link>
        <router-link to='/cart' tag='li'>
          <span class="iconfont icon-gouwuche2">
            <span class="cartNum">{{ $store.getters.totalNum }}</span>
          </span>
          <p>
            购物车
          </p>
        </router-link>
        <router-link to='/user' tag='li'>
          <span class="iconfont icon-wode"></span>
          <p>我的</p>
        </router-link>
      </ul>
    </footer>
</template>

<script>
import { mapActions } from 'vuex'
export default {
  methods: {
    ...mapActions({
      getCartData: 'cart/getCartData'
    })
  },
  mounted () {
    // console.log(this.$store.getters.totalNum)
    this.getCartData(localStorage.getItem('userid'))
  }
}
</script>
